package cc.comac.mom.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.ExcelImportCmd;
import cc.comac.mom.export.SparePartsTypeImport;

@RestController
@RequestMapping("/ExcelImportExport")
public class ExcelImportExportController {
	@Autowired
	private ExcelImportCmd excelImportCmd;
	@RequestMapping(value = "/downloadTemplate",method = RequestMethod.POST)
	public void downloadTemplate(@RequestParam("filename") String filename,HttpServletResponse request, HttpServletResponse response) throws IOException, ClassNotFoundException{
		String name = SparePartsTypeImport.class.getName();
		excelImportCmd.downloadTemplate(name, filename);
	}
}
